package com.huoyun.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ui.AbstractUITag;

import com.opensymphony.xwork2.util.ValueStack;

public class PageTag extends AbstractUITag {

	private static final long serialVersionUID = 1L;
	protected String totalRecord;
	protected String totalPage;
	protected String pageNo;
	protected String url;
	protected boolean isAjax = false;
	protected String ajaxDiv = "div";
	protected String style = "basic";

	@Override
	public Component getBean(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		return new PageBean(stack, request, response);
	}

	protected void populateParams() {
		super.populateParams();
		PageBean pageBean = (PageBean) component;
		pageBean.setTotalRecord(totalRecord);
		pageBean.setTotalPage(totalPage);
		pageBean.setPageNo(pageNo);
		pageBean.setUrl(url);
		pageBean.setIsAjax(isAjax);
		pageBean.setAjaxDiv(ajaxDiv);
		pageBean.setStyle(style);
	}

	public String getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(String totalRecord) {
		this.totalRecord = totalRecord;
	}

	public String getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(String totalPage) {
		this.totalPage = totalPage;
	}

	public String getPageNo() {
		return pageNo;
	}

	public void setPageNo(String pageNo) {
		this.pageNo = pageNo;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public boolean getIsAjax() {
		return isAjax;
	}

	public void setIsAjax(boolean isAjax) {
		this.isAjax = isAjax;
	}

	public String getAjaxDiv() {
		return ajaxDiv;
	}

	public void setAjaxDiv(String ajaxDiv) {
		this.ajaxDiv = ajaxDiv;
	}

}
